import React, { createContext, useContext } from 'react'
import { useLocalStorage } from '@rehooks/local-storage'

const AuthContext = createContext();

export const useAuth = () => useContext(AuthContext)
export const avatarBaseUrl = 'http://localhost:2024/img/'

const AuthProvider = ({ children }) => {
    const [user, setUser, deleteUser] = useLocalStorage('user', {});
    return (
        <AuthContext.Provider value={{ user, setUser, deleteUser }}>
            {children}
        </AuthContext.Provider>
    )
}

export default AuthProvider